/*
 * Created by 岱青海蓝信息系统(北京)有限公司 on 17-5-17 上午10:53
 * Copyright (c) 2017. All rights reserved.
 */

package com.example.dqhl.recycleviewdemo.util;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * Created by dqhl on 17/5/17.
 */
public class DividerStraggeDecoration extends RecyclerView.ItemDecoration {
    private int space;

    public DividerStraggeDecoration(int space) {
        this.space=space;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        outRect.left=space;
        outRect.right=space;
        outRect.bottom=space;
        if(parent.getChildAdapterPosition(view)==0){
            outRect.top=space;
        }
    }
}
